package com.ymttest.database.sqlwapper;

import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.database.model.YmtFundDimension;
import com.ymttest.database.model.YmtProducts;
import com.ymttest.database.model.YmtProductsI;
import com.ymttest.utils.EnvSetup;

/************************************************************************************
 * @File name : YmtProductsIWapper.java
 * @Author : 徐洁伟
 * @Date : 2016年6月28日
 * @Copyright : 洋码头
 * 商品合库 新库
 ************************************************************************************/
public class YmtFundDimensionWapper {
	SqlManager manage;

	public YmtFundDimensionWapper() {
		manage = new SqlManager("ymtfp");
	}

	//查询
	public List<YmtFundDimension> selectdimension(String strategyDimensionName) throws InterruptedException {
	    @SuppressWarnings("unchecked")
	    List<YmtFundDimension>  dimensionlist = manage.getSelectResults(
	            "com.ymttest.database.mapping.YmtFPMapper.selectdimension", strategyDimensionName);
	    manage.commit();
	    return dimensionlist;
	}
	
		//查询		
		public List<Map> selectstrategyidbyrange(String beginendrange) throws InterruptedException {
//			Map m = new HashMap<>();
//			m.put("strategyleveltype", strategyleveltype);
//			m.put("strategytype", strategytype);
//			m.put("beginendrange", beginendrange);
//			m.put("beginendtime", beginendtime);
			List<Map> pia = manage.getSelectResults(
					"com.ymttest.database.mapping.YmtFPMapper.selectstrategyidbyrange", beginendrange );
			// manage.close();
			return pia;
		}
		
		//查询		
		public List<Map> selectstrategyidbyuserid(String sdiuserid) throws InterruptedException {
			List<Map> sd = manage.getSelectResults(
					"com.ymttest.database.mapping.YmtFPMapper.selectstrategyidbyuserid", sdiuserid );
			// manage.close();
			return sd;
		}
		
		//更新策略状态
	    public void updateStrategyStatusByStrategyId(String strategyId) {
	    	Logger.comment("修改策略为无效-1，策略id:"+strategyId);
	        int result = manage.update("com.ymttest.database.mapping.YmtFPMapper.updateStrategyStatusByStrategyId", strategyId);
	        manage.commit();
	    }
	    
		//查询		
		public List<Map> selectstrategyidforhighleveltype(BigDecimal beginRange) throws InterruptedException {
			List<Map> sd = manage.getSelectResults(
					"com.ymttest.database.mapping.YmtFPMapper.selectstrategyidforhighleveltype", beginRange );
			// manage.close();
			return sd;
		}
		
		//查询		
		public List<Map> selectstrategybystrategytype(String strategytype) throws InterruptedException {
			List<Map> sd = manage.getSelectResults(
					"com.ymttest.database.mapping.YmtFPMapper.selectstrategybystrategytype", strategytype );
			// manage.close();
			return sd;
		}
		
		//查询		
		public List<Map> selectstrategyforrefund(Map m) throws InterruptedException {
			List<Map> sd = manage.getSelectResults(
					"com.ymttest.database.mapping.YmtFPMapper.selectstrategyforrefund", m );
			// manage.close();
			return sd;
		}		

		public List<Map> commissionbysellerid(Map m) throws InterruptedException {
			List<Map> sd = manage.getSelectResults("com.ymttest.database.mapping.YmtFPMapper.commissionbysellerid", m );
			// manage.close();
			return sd;
		}
		
		public List<Map> commissiongetsellerid(Map m) throws InterruptedException {
			List<Map> sd = manage.getSelectResults("com.ymttest.database.mapping.YmtFPMapper.commissiongetsellerid", m );
			// manage.close();
			return sd;
		}
		
		public List<Map> commissionchackforamount(Map m) throws InterruptedException {
			List<Map> sd = manage.getSelectResults("com.ymttest.database.mapping.YmtFPMapper.commissionchackforamount", m );
			// manage.close();
			return sd;
		}
		
		public List<Map> taxRateforcommission(Map m) throws InterruptedException {
			List<Map> sd = manage.getSelectResults("com.ymttest.database.mapping.YmtFPMapper.taxRateforcommission", m );
			// manage.close();
			return sd;
		}
		
		//Ymt_CommissionCheckBills
		public List<Map> commissionCheckBillsbyBusinessType(int businessType) throws InterruptedException {
			List<Map> sd = manage.getSelectResults("com.ymttest.database.mapping.YmtFPMapper.commissionCheckBillsbyBusinessType", businessType );
			// manage.close();
			return sd;
		}
		public List<Map> commissionCheckBillsbyOrderId(Map m) throws InterruptedException {
			List<Map> sd = manage.getSelectResults("com.ymttest.database.mapping.YmtFPMapper.commissionCheckBillsbyOrderId", m );
			// manage.close();
			return sd;
		}
		
		//<Ymt_CommissionOrderDetail> left join <Ymt_CommissionOrderInvoice>
		public List<Map> commissionOrderbyBusinessType(int businessType) throws InterruptedException {
			List<Map> sd = manage.getSelectResults("com.ymttest.database.mapping.YmtFPMapper.commissionOrderbyBusinessType", businessType );
			// manage.close();
			return sd;
		}
		public List<Map> commissionOrderbyOrderinfoId(Map m) throws InterruptedException {
			List<Map> sd = manage.getSelectResults("com.ymttest.database.mapping.YmtFPMapper.commissionOrderbyOrderinfoId", m );
			// manage.close();
			return sd;
		}
		
	public static void main(String args[]) {
	    try {	         
	    	YmtFundDimensionWapper ymtFundDimensionWapper = new YmtFundDimensionWapper();
	    	Map m = new HashMap();
	    	m.put("businessType", 11);
	    	m.put("orderInfoId", "57ad58c0ef2e884d0c648b51");
	        List<Map> rm = ymtFundDimensionWapper.commissionOrderbyOrderinfoId(m);
	        Logger.debug(rm.get(0).get("OrderId")); 
	    } catch (InterruptedException e) {
	        e.printStackTrace();
	    }
	}
	
//	public static void main(String args[]) {
//	    	new YmtFundDimensionWapper().updateStrategyStatusByStrategyId("830243f8-ed57-49c2-b0d0-de2aa6d63c0a");	         
//	}
	
}
